<?php

namespace App\Http\Controllers\v1;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Traits\Resource;
use App\Models\User;
use Illuminate\Support\Facades\Log;

class ExampleController extends Controller
{
    use Resource;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->model = new User();
        $this->searchable = [
            'user_name','user_mobile'
        ];
        $this->field = ['id','user_name'];
        Log::info(1111);
    }

    public function filters(): array
    {
        return [
            'user_name' => self::$filter_equal,
            'user_mobile' => self::$filter_equal,
        ];
    }

    public function rules(): array
    {
        return [
            'user_name' => 'required',
            'user_email' => 'required',
            'user_mobile' => 'required',
        ];
    }

    public function attributes(): array
    {
        return [
            'user_name' => '用户名',
            'user_email' => '用户名',
        ];
    }
    //
//    public function test()
//    {
//        dd(\request()->route());
//        $this->model = $this->model->where('user_name',1);
//        $this->model = $this->model->where('user_mobile',1);
//        $a = $this->model->get();
//        dd($a);
//        $test = new Test();
//        $test->setKeyParameter();
//        $test->set(['itianyu'=>11,'A'=>3432,'test'=>'你卡沙']);
//        $test = $test->get();
//        return $this->success($test);
//    }

}
